Exemple #1
0
void wm_debug_type(enum wm_debug_t type, const gchar *a, ...)
{
	va_list vl;
	va_start(vl, a);
	log_argv(type, a, vl);
	va_end(vl);
}
Exemple #2
0
void wm_debug(const gchar *a, ...)
{
	va_list vl;
	va_start(vl, a);
	log_argv(WM_DEBUG_NORMAL, a, vl);
	va_end(vl);
}
Exemple #3
0
void ob_debug_type(ObDebugType type, const gchar *a, ...)
{
    va_list vl;

    va_start(vl, a);
    log_argv(type, a, vl);
    va_end(vl);
}
Exemple #4
0
int main( int argc, char** argv ) {
   
   struct log_context* logctx = NULL;
   int rc = 0;
   
   if( strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 ) {
      fprintf(stderr, "Log test program\n");
      trace_usage();
      exit(0);
   }
   
   rc = trace_begin( &logctx );
   if( rc != 0 ) {
      fprintf(stderr, "trace_begin rc = %d\n", rc );
      exit(1);
   }
   
   log_argv( logctx, argc, argv );
   
   // compress 
   rc = log_rollover( logctx );
   if( rc != 0 ) {
      
      fprintf(stderr, "log_rollover rc = %d\n", rc );
      exit(1);
   }
   
   log_argv( logctx, argc, argv );
   
   // compress, again 
   rc = log_rollover( logctx );
   if( rc != 0 ) {
      
      fprintf(stderr, "log_rollover rc = %d\n", rc );
      exit(1);
   }
   
   // where are the compressed logs?
   print_compressed_log_paths( logctx );
   
   // clean up 
   trace_end( &logctx );
   
   return 0;
}
bool CmdlineParser::parse_argv(const std::vector<WTF8::u8string> &argv) const {
    if(argv.size() >= 5) {
        log_argv(argv);
        return analyze_argv(argv);
    } else {
        print_help(argv[0]);
        std::exit(argv.size() == 1 ? 0 : 1);
    }
}
Exemple #6
0
  Environment::Environment(int argc, char** argv)
    : argc_(argc)
    , argv_(0)
    , fork_exec_lock_()
    , halt_lock_()
    , finalizer_thread_(NULL)
    , loader_(NULL)
  {
    String::init_hash();

    copy_argv(argc, argv);
    ruby_init_setproctitle(argc, argv);

    shared = new SharedState(this, config, config_parser);

    load_vm_options(argc_, argv_);

    check_io_descriptors();

    root_vm = shared->thread_nexus()->new_vm(shared, "ruby.main");
    root_vm->set_main_thread();
    shared->set_root_vm(root_vm);

    size_t stack_size = 0;
    struct rlimit rlim;

    if(getrlimit(RLIMIT_STACK, &rlim) == 0) {
      stack_size = rlim.rlim_cur;
    }

    root_vm->set_stack_bounds(stack_size);
    root_vm->set_current_thread();

    state = new State(root_vm);

    loader_ = new memory::TypedRoot<Object*>(state);

    NativeMethod::init_thread(state);

    start_logging(state);
    log_argv();

    if(config.log_config.value) {
      std::string options;

      config_parser.parsed_options(options);
      if(options.size()) {
        logger::write("config: %s", options.c_str());
      }
    }
  }
Exemple #7
0
int     main(int argc, char **argv)
{
    struct stat st;
    char   *slash;
    int     fd;
    int     ch;
    const char *tag;
    int     log_flags = 0;
    int     level = MSG_INFO;

    /*
     * Fingerprint executables and core dumps.
     */
    MAIL_VERSION_STAMP_ALLOCATE;

    /*
     * Be consistent with file permissions.
     */
    umask(022);

    /*
     * To minimize confusion, make sure that the standard file descriptors
     * are open before opening anything else. XXX Work around for 44BSD where
     * fstat can return EBADF on an open file descriptor.
     */
    for (fd = 0; fd < 3; fd++)
	if (fstat(fd, &st) == -1
	    && (close(fd), open("/dev/null", O_RDWR, 0)) != fd)
	    msg_fatal("open /dev/null: %m");

    /*
     * Set up diagnostics.
     */
    if ((slash = strrchr(argv[0], '/')) != 0 && slash[1])
	tag = mail_task(slash + 1);
    else
	tag = mail_task(argv[0]);
    if (isatty(STDERR_FILENO))
	msg_vstream_init(tag, VSTREAM_ERR);
    msg_syslog_init(tag, LOG_PID, LOG_FACILITY);

    /*
     * Check the Postfix library version as soon as we enable logging.
     */
    MAIL_VERSION_CHECK;

    /*
     * Parse switches.
     */
    while ((ch = GETOPT(argc, argv, "c:ip:t:v")) > 0) {
	switch (ch) {
	default:
	    msg_fatal("usage: %s [-c config_dir] [-i] [-p priority] [-t tag] [-v] [text]", tag);
	    break;
	case 'c':
	    if (setenv(CONF_ENV_PATH, optarg, 1) < 0)
		msg_fatal("out of memory");
	    break;
	case 'i':
	    log_flags |= LOG_PID;
	    break;
	case 'p':
	    level = level_map(optarg);
	    break;
	case 't':
	    tag = optarg;
	    break;
	case 'v':
	    msg_verbose++;
	    break;
	}
    }

    /*
     * Process the main.cf file. This overrides any logging facility that was
     * specified with msg_syslog_init();
     */
    mail_conf_read();
    if (tag == 0 && strcmp(var_syslog_name, DEF_SYSLOG_NAME) != 0) {
	if ((slash = strrchr(argv[0], '/')) != 0 && slash[1])
	    tag = mail_task(slash + 1);
	else
	    tag = mail_task(argv[0]);
    }

    /*
     * Re-initialize the logging, this time with the tag specified in main.cf
     * or on the command line.
     */
    if (tag != 0) {
	if (isatty(STDERR_FILENO))
	    msg_vstream_init(tag, VSTREAM_ERR);
	msg_syslog_init(tag, LOG_PID, LOG_FACILITY);
    }

    /*
     * Log the command line or log lines from standard input.
     */
    if (argc > optind) {
	log_argv(level, argv + optind);
    } else {
	log_stream(level, VSTREAM_IN);
    }
    exit(0);
}