Turn on/off all logging on the Tropo platform
      Argument: state is a String
      See https://www.tropo.com/docs/webapi/generallogsecurity
546736
def generalLogSecurity(self, state, **options):
      
      self._steps.append(GeneralLogSecurity(state).obj)
995404
function _switchState(state) {
            // clear previous interval if any
            _stopRunLoop();

            // call the stage destroy method
            if (_stages[_state]) {
                // just notify the object
                _stages[_state].stage.destroy();
            }

            if (_stages[state]) {
                // set the global variable
                _state = state;

                // call the reset function with _extraArgs as arguments
                _stages[_state].stage.reset.apply(_stages[_state].stage, _extraArgs);

                // and start the main loop of the
                // new requested state
                _startRunLoop();

                // execute callback if defined
                if (_onSwitchComplete) {
                    _onSwitchComplete();
                }

                // force repaint
                me.game.repaint();
            }
        }
1154438
private String isLoggedIn() throws RuntimeException {
        if(this.getUser() != null && this.getUser().getAuthToken() != null){
            return "CUSTOM " + this.getUser().getAuthToken();
        } else {
            throw new RuntimeException("User state error.");
        }
    }
306644
def _set_status(m,
                comment=INVALID_RESPONSE,
                status=False,
                out=None):
    '''
    
    '''
    m['out'] = out
    m['status'] = status
    m['logs'] = LOG.messages[:]
    m['logs_by_level'] = LOG.by_level.copy()
    outlog, outlog_by_level = '', ''
    m['comment'] = comment
    if out and isinstance(out, six.string_types):
        outlog += HR
        outlog += 'OUTPUT:\n'
        outlog += '{0}\n'.format(_encode_string(out))
        outlog += HR
    if m['logs']:
        outlog += HR
        outlog += 'Log summary:\n'
        outlog += HR
        outlog_by_level += HR
        outlog_by_level += 'Log summary by level:\n'
        outlog_by_level += HR
        for level, msg in m['logs']:
            outlog += '\n{0}: {1}\n'.format(level.upper(),
                                            _encode_string(msg))
        for logger in 'error', 'warn', 'info', 'debug':
            logs = m['logs_by_level'].get(logger, [])
            if logs:
                outlog_by_level += '\n{0}:\n'.format(logger.upper())
                for idx, log in enumerate(logs[:]):
                    logs[idx] = _encode_string(log)
                outlog_by_level += '\n'.join(logs)
                outlog_by_level += '\n'
        outlog += HR
    m['outlog'] = outlog
    m['outlog_by_level'] = outlog_by_level
    return _encode_status(m)
822677
function configureDebugMode (logLevel) {
  // because Listr logs to stdout (not configurable), make debug() do the same
  // otherwise file redirection gets very confusing
  debug.log = function () {
    const line = util.format.apply(util, arguments) + '\n'
    process.stdout.write(line)
  }

  // TTY-related configuration
  const supportsANSI = tty.isatty(process.stdout.fd)
  debug.useColors = () => supportsANSI
  if (!supportsANSI) {
    overrideDebugFormat()
  }

  // enable the right log levels
  if (logLevel === 'trace') debug.enable('*')
  if (logLevel === 'debug') debug.enable('thumbsup:error,thumbsup:warn,thumbsup:info,thumbsup:debug')
  if (logLevel === 'info') debug.enable('thumbsup:error,thumbsup:warn,thumbsup:info')

  // capture any additional console.log() calls, including Listr task updates
  console.log = require('debug')('thumbsup:info')
  console.info = require('debug')('thumbsup:info')
  console.warn = require('debug')('thumbsup:warn')
  console.error = require('debug')('thumbsup:error')
}
1050040
function logStateUpdate(currentState, nextState) {
  if (console.group) { console.group('%cState mutation', 'font-weight: bold;') }
  console.log('%cCurrent state', 'color: gray; font-weight: bold; %O', currentState.toJS())
  const operations = diff(currentState, nextState)
  if (operations.size > 1) {
    console.log('%cOperations %O', 'font-weight: bold;', diff(currentState, nextState).toJS())
  } else if (operations.size === 1) {
    const operation = operations.first().toJS()
    console.log(
      '%cOperation',
      'font-weight: bold;',
      operation.op, operation.path, operation.value
    )
  } else {
    console.log('%cOperation', 'font-weight: bold;', 'Noop')
  }
  console.log('%cNext state', 'color: green; font-weight: bold; %O',
              nextState ? nextState.toJS() : '')

  if (console.groupEnd) console.groupEnd()
}
213714
function mkLoggerIfNeeded(level) {
    if (console && console[level] && typeof console[level] == "function" && console[level].call) {
        return function() {
            if (console[level].apply) {
                console[level].apply(console, [].slice.call(arguments));
            } else if (console[level].call) {
                console[level]([].slice.call(arguments).join(" "));
            }
        }
    } else if (console && console.log) {
        var prefix = level.toUpperCase()+": ";
        return function() {
            console.log(prefix + [].slice.call(arguments).join(" "));
        }
    } else return function(){ /* NOOP Logging IE<=8, FF<=2 */ };
}
648324
function(state) {
				var runtime = this.getRuntime();
				if (runtime) {
					runtime.exec.call(this, 'FileInput', 'disable', Basic.typeOf(state) === 'undefined' ? true : state);
				}
			}
1110573
def _generate_state() -> str:
        
        state = str(uuid.uuid4()).replace('-', '')
        logger.debug("Generated OAuth state: %s" % state)
        return state
86668
def toggle_state(self, state, active=TOGGLE, scope=None):
        
        self.conversation(scope).toggle_state(state, active)
695495
def setLogSettings(state):
    

    global _DEBUG
    global _log_handlers
    global _log_handlers_limited

    (_DEBUG,
     categories,
     _log_handlers,
     _log_handlers_limited) = state

    for category in categories:
        registerCategory(category)
560947
function RoostUserStatus(message, code) {
  MessagingUserStatus.call(this, 'roost');

  this.state.message = message;

  if (code === 'missing') {
    this.state.code = this.StatusCodes.MISSING;

  } else if (code === 'ok') {
    this.state.code = this.StatusCodes.VALID;

  } else {
    this.state.code = this.STatusCodes.DEFAULT;
  }
}
447269
function Logger(opt) {
    var self = {};

    var defaultOptions = {
        name: 'gina', // by default
        template: '%d [ %s ] %m',
        //containers: [],
        levels : { // based on Sylog Severity Levels
            emerg: {
                code: 0,
                label: 'Emergency',
                desciption: 'System is unusable.',
                color: 'red'
            },
            alert: {
                code: 1,
                label: 'Alert',
                desciption: 'Action must be taken immediately.',
                color:'red'
            },

            crit: {
                code: 2,
                label: 'Critical',
                desciption: 'Critical conditions.',
                color: 'red'
            },
            error : {
                code: 3,
                label: 'Error',
                desciption: 'Error conditions.',
                color : 'orange'
            },
            warn : {
                code: 4,
                label: 'Warning',
                desciption: 'Warning conditions.',
                color: 'yellow'
            },
            notice: {
                code: 5,
                label: 'Notice',
                desciption: 'Normal but significant condition.',
                color: 'yellow'
            },
            info : {
                code: 6,
                label: 'Informational',
                desciption: 'Informational messages.',
                color: 'blue'
            },
            debug : {
                code: 7,
                label: 'Debug',
                desciption: 'Debug-level messages.',
                color: 'cyan'
                //'format' : '',
                //'pipe' : []
            }

        }
    };

    if (opt) {
        opt = merge(defaultOptions, opt, true)
    } else {
        opt = defaultOptions
    }

    /**
     * init
     * @constructor
     * */
    var init = function(opt) {
        if ( typeof(Logger.initialized) != "undefined" ) {
            console.debug("Logger instance already exists. Loading it.");
            return getInstance(opt)
        } else {
            Logger.initialized = true;
            Logger.instance = self;
            setDefaultLevels();
        }
    }

    var getInstance = function(opt) {
        return Logger.instance
    }

    var setDefaultLevels = function() {

        for (var l in opt.levels) {
            if ( typeof(self[l]) != 'undefined' )
                delete self[l];

            //self[l] = new Function('return '+write+'('+JSON.stringify(opt)+', '+parse+', "'+l+'", arguments);');
            self[l] = new Function('this._log_printed = false; process.stdout.write('+write+'('+JSON.stringify(opt)+', '+parse+', "'+l+'", arguments));');
        }
    }

    var write = function(opt, parse, s, args) {

        if ( /^(debugger listening on port)/.test(args[0])
            && typeof(opt.levels.info) != 'undefined'
        ) {
            s = 'info'
        }
        //process.stdout.write('\n'+ "LOGGER ACTION ? "+ s + ": ("+args.length+") ["+ args[0]+ "]");
        var content = '';
        //To handle logs with coma separated arguments.
        for (var i=0; i<args.length; ++i) {
            if (args[i] instanceof Function) {
                content += args[i].toString() + ''
            } else if (args[i] instanceof Object) {
                // careful, [ parse ] will be out of the main execution context: passing it for recursive use
                content += parse(parse, args[i], '')
            } else {
                //if ( args[i].replace(/\s/g, '') != '')
                //process.stdout.write('\n'+ ("=>> [" + args[i] + "]"));
                content += args[i] + ' '
            }
        }

        if (content != '' && !this._log_printed) {
            var now = new Date();
            var repl = {
                '%s': s, //severity
                '%d': now, // timestamp
                '%m': content // message
                //'%container', //container
            };

            var patt = opt.template.match(/\%[a-z A-Z 0-9]/g);
            content = opt.template;
            for(var p=0; p<patt.length; ++p) {
                content = content.replace(new RegExp(patt[p], 'g'), repl[patt[p]]);
            }

            //return process.stdout.write('\n'+ content)
            this._log_printed = true;
            return '\n'+ content
        }

        this._log_printed = false;
        return content
    }

    var parse = function(parse, obj, str) {
        var l = 0
            , len = obj.count()
            , isArray = (obj instanceof Array) ? true : false;
        str += (isArray) ? '[ ' : '{';

        for (var attr in obj) {
            ++l;
            if (obj[attr] instanceof Function) {
                str += attr +': [Function]';
                // if you want ot have it all replace by the fllowing line
                //str += attr +':'+ obj[attr].toString();
                str += (l<len) ? ', ' : ''
            } else if (obj[attr] instanceof Object && !isArray) {
                str += '"'+attr+'": ';
                str = parse(parse, obj[attr], str);
                str += (l<len) ? ', ' : '';
            } else {
                if (!isArray && typeof(obj[attr]) == 'string') {
                    str += '"'+attr+'": "' + obj[attr]
                            .replace(/\'/g, "\\'")
                            .replace(/\"/g, '\\"') +'"';
                } else if (isArray) {
                    str += ( typeof(obj[attr]) != 'string' ) ? obj[attr] : '"'+ obj[attr] +'"'
                } else {
                    str += '"'+attr+'": ' + obj[attr]
                }
                str += (l<len) ? ', ' : ''
            }
        }

        str += (isArray) ? ' ]' : '}';
        return str + ' '
    }

//    /**
//     * Add or override existing level(s)
//     * @param {object} levels
//     * */
//    this.addLevel = function(levels) {
//        for (var l in levels) {
//            self[l] = new Function('return '+write+'('+JSON.stringify(opt)+', "'+l+'", arguments);');
//        }
//    }

    self.setLevels = function(levels) {
        try {
            //remove default.
            for (var l in opt.levels) {
                delete self[l]
            }


            for (var l in levels) {
                self[l] = new Function('return '+write+'('+JSON.stringify(opt)+', '+parse+', "'+l+'", arguments);');
            }
        } catch(e) {
            setDefaultLevels();
            self.error('Cannot set type: ', e.stack|| e.message)
        }
    }

    self.getLogger = function(details) {
        console.debug('getting logger')
    }

    self.log = function() {
        var args = arguments, content = '';
        //console.log("arg: ", args);
        //To handle logs with coma speparated arguments.
        for (var i=0; i<args.length; ++i) {

            if (args[i] instanceof Object) {
                //console.log("\n...", args[i], args[i].toString());
                content += JSON.stringify(args[i], null, '\t')
            } else {
                content += args[i]
            }
        }
        //process.stdout.write('\n'+ "hum ? "+ content);
        //console.log("hum ? ", content);
        if (content != '')
            process.stdout.write('\n'+ content)
    }


    init(opt);
    return self
}
1048387
def set_connection_logging(self, loadbalancer, val):
        
        uri = "/loadbalancers/%s/connectionlogging" % utils.get_id(loadbalancer)
        val = str(val).lower()
        req_body = {"connectionLogging": {
                "enabled": val,
                }}
        resp, body = self.api.method_put(uri, body=req_body)
        return body
66133
private String getState(int state)
   {
      String st = "";
      switch (state)
      {

         case BackupJob.FINISHED :
            st = "finished";
            break;

         case BackupJob.WORKING :
            st = "working";
            break;

         case BackupJob.WAITING :
            st = "waiting";
            break;

         case BackupJob.STARTING :
            st = "starting";
            break;
         default :
            break;
      }

      return st;
   }
724370
function isLoggingConfigured(target) {
  return target && isBoolean(target.warnEnabled) && isBoolean(target.infoEnabled) && isBoolean(target.debugEnabled)
    && isBoolean(target.traceEnabled) && typeof target.error === 'function' && typeof target.warn === 'function'
    && typeof target.info === 'function' && typeof target.debug === 'function' && typeof target.trace === 'function';
}
1283531
private void checkState() {
        if (startWith == null && lastResult == null) {
            final String msg = "Please call startWith(uri) first.";
            LOG.error(msg);
            throw new IllegalStateException(msg);
        }
    }